package demo8;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.sql.SQLException;

public class Demo {
    public static void main(String[] args) throws SQLException {
        AnnotationConfigApplicationContext context =
                new AnnotationConfigApplicationContext(Config.class);

        Person p = context.getBean(Person.class);
        System.out.println(p);

        Student s= context.getBean(Student.class);//这就相当于new一个对象
        System.out.println(s);

        DBUtil dbutil= context.getBean(DBUtil.class);
        System.out.println(dbutil.getConnection());
    }
}
